//
//  BufferedFile.h
//  3DImportTest
//
//  Created by David Michaeli on 26/08/12.
//  Copyright (c) 2012 David Michaeli. All rights reserved.
//

#ifndef _BufferedFile_h
#define _BufferedFile_h

#include <sys/stat.h>
#include <stdio.h>

typedef struct
{
    FILE* fid;
    char* buffer;
    unsigned long cur_pos;
    struct stat statistics;
    
    unsigned long current_buffer_size;
    unsigned long actual_block_size;
} BufferedFile;


BufferedFile*   OpenFile            (char *fname, char *flags);
void            CloseFile           (BufferedFile* file);
unsigned int    ReadData            (BufferedFile* file, unsigned int size, char* buffer);
unsigned int    WriteData           (BufferedFile* file, unsigned int size, char* buffer);
char*           ReadLineFromFile    (BufferedFile* file, char* line, unsigned int max_size);
int             WriteLineIntoFile   (BufferedFile* file, char* line);

#endif
